home *** CD-ROM | disk | FTP | other *** search
- /* - vue.c hex dump routine - */
-
- #include <stdio.h>
-
- main(argc,argv)
- int argc;
- char *argv[];
- {
-
- FILE *fp,*fopen();
-
- if(argc==1){
- printf("%s","no file specified in command line");
- exit(0);
- }
- while(--argc>0)
- if((fp=fopen(*++argv,"r"))==NULL){
- printf("vue: cannot open %s\n",*argv);
- break;
- }
- else{
- hexdump(fp);
- fclose(fp);
- }
- }
-
- hexdump(fp)
-
- #define high_order 35512
- #define low_order 255
-
- FILE *fp;
- {
- unsigned word,byte[16],count,index;
- long address;
- int dummy,word_bound;
-
- address=0;
- while(address>-1 && address<128000 && word != EOF){
- count=0;
- while(count<256 && word != EOF){
- printf("%6x ",address);
- index=0;
- word_bound=0;
- while(index<16 && word != EOF){
- if((word=getc(fp)) != EOF){
- byte[index]=word & low_order;
- if(byte[index]<16)printf("0%x",byte[index]);
- else
- printf("%x",byte[index]);
- }
- else
- printf("%x",(word&low_order));
- index++;
- word_bound++;
- if(word_bound == 2){
- printf(" ");
- word_bound=0;
- }
- }
- while(index<16){
- printf(" ");
- if((index/2)*2 != index) printf(" " );
- byte[index] = EOF;
- index++;
- }
- printf(" ");
- for(index=0;index<16;){
- if(byte[index]>31 && byte[index]<128)
- printf("%c",byte[index]);
- else
- printf(".");
- index++;
- }
- printf("\n");
- count += 16;
- address += 16;
- }
- if(word != EOF)
- dummy=getc(stdin);
- }
- }
- }
- printf("\n");
- count += 16;
- address += 16;
- }
- if(word != EOF)
- dummy=getc